// 引入 mongoose 模块
const mongoose = require('mongoose')

// 创建文档的结构对象
const BookSchema = new mongoose.Schema({
    name: String,
    author: String,
    price: Number,
    isHot: Boolean,
    tags: Array,
    publishTime: Date,
    test: mongoose.Schema.Types.Mixed, // 任意类型
})

// 创建模型对象 对文档操作额封装
const BookModel = mongoose.model('books', BookSchema)

// 导出模型对象
module.exports = BookModel
